<template>
  <el-dialog v-if="load" title="更多记录" v-model="visible" append-to-body :close-on-click-modal="false" :z-index="2000" width="800px" @close="handleClose">
    <vxe-table :data="data">
      <vxe-column title="变更人" field="create_user" width="140"></vxe-column>
      <vxe-column title="变更时间" field="create_time" width="160"></vxe-column>
      <vxe-column title="变更内容" field="reason"></vxe-column>
    </vxe-table>
    <template #footer>
      <el-button @click="close">关 闭</el-button>
    </template>
  </el-dialog>
</template>

<script setup>
import api from '../api'
import { ElMessage } from 'element-plus'

const props = defineProps({
  options: { type: Object, default: () => ({}) },
})
const emit = defineEmits(['close', 'success'])

const load = ref(false)
const visible = ref(false)
let loadings = reactive({})
const data = ref([])

// 打开弹窗
const open = async (pds_id) => {
  console.log('pds_id', pds_id)
  if (!load.value) {
    load.value = true
    await 1
  }
  api.historyRemark({pds_id, reason_type: 5}).then(res => {
    data.value = res.data
    loadings = reactive({})
    visible.value = true
  })
}
// 关闭弹窗
const close = () => {
  visible.value = false
}

const handleClose = () => {
  emit('close')
}

defineExpose({ open })
</script>